/*
 * ImageIO.h
 *
 *  Created on: Aug 26, 2011
 *      Author: ryan
 */

#ifndef IMAGEIO_H_
#define IMAGEIO_H_

#define HEADERSIZE 54
#define PALLETSIZE 1024

#include "Common.h"
#include "Image.h"

class ImageIO {
public:
	static void ReadBmpImage(char *filename, Image *Imagep);
	static void WriteBmpImage(char *filename, Image *tp);

	static void PrintBmpInfo(char *filename);
	static void HMirror(Image *sp, Image *tp);
	static void VMirror(Image *sp, Image *tp);
	static void Rotate90(int a, Image *sp, Image *tp);
	static void Shrink(int a, Image *sp, Image *tp);
	static void Mosaic(int a, Image *sp, Image *tp);
	static void Gray(Image *sp, Image *tp);
	static void Diminish(Image *sp, Image *tp, unsigned char x);
private:
	static int max_arg3(int x, int y, int z) {
		int max = x;
		if (max < y) {
			max = y;
		}
		if (max < z) {
			max = z;
		}
		return max;
	}
	static unsigned char Bmp_headbuf[HEADERSIZE];
	static unsigned char Bmp_Pallet[PALLETSIZE];
	static char Bmp_type[2];
	static unsigned long Bmp_size;
	static unsigned int Bmp_info_header_size;
	static unsigned int Bmp_header_size;
	static int Bmp_height;
	static int Bmp_width;
	static unsigned short Bmp_planes;
	static unsigned short Bmp_color;
	static long Bmp_comp;
	static long Bmp_image_size;
	static long Bmp_xppm;
	static long Bmp_yppm;
};

#endif /* IMAGEIO_H_ */
